{extend name="public:layout" /}
{block name="title"}添加分组{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> <a href="{:url('index')}">分组列表</a></li>
                <li class="active">添加分组</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">上级分组</label>
                    <div class="col-sm-3">
                        <select name="pid" class="form-control">
                            <option value="0">===顶级分组===</option>
                            {volist name="catList" id="vo"}
                            <option value="{$vo.cid}" {eq name="vo.cid" value="$Request.param.pid" }selected{/eq}>{$vo._name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="col-sm-2">
                        <label class="checkbox-inline i-checks">
                            <input type="checkbox" name="is_batch" value="1"/> 批量模式
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">分组名称</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control one" placeholder="请输入分组名称" name="cat_name" />
                        <textarea class="form-control two" name="cat_names" rows="5" placeholder="一行一个栏目" style="display:none;"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">分组图片</label>
                    <div class="col-sm-4">
                        <p class="form-control-static">
                            {:widget('common/Form/singleImg',['cat_image','',$uid])}
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">关键字</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="cat_keywords" value=""/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">描述</label>
                    <div class="col-sm-10">
                        <textarea class="form-control" name="cat_description" rows="3"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">分组排序</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control"
                               name="cat_order" value="0" datatype="n"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" type="button" id="btnSub">
                            保存内容
                        </button>
                        <a href="{:url('index')}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        ajaxSubForm('#btnSub');
        In('icheck',function () {
            iCheck();
            $("input[name='is_batch']").on('ifChanged', function (event) {
                if ($(this).prop('checked')) {
                    $('.two').show();
                    $('.one').hide();
                } else {
                    $('.two').hide();
                    $('.one').show();
                }
            });
        })
    })
</script>
{/block}
